Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Clangd-wasm example, build LS images with GHA #734

Merged
merged 3 commits into from
Oct 23, 2024
Merged

Conversation

kaisalmen
Copy link
Collaborator

@kaisalmen kaisalmen commented Aug 23, 2024

This PR adds the clangd wasm port from https://github.com/guyutongxue/clangd-in-browser into a new example. The client side of the example is already clean-up / aligned to the other example. TODO: The server side code needs some polishing.

In addition the following things have been added along:

  • GHA actions that build all container based language servers (groovy, eclipse.jdt.ls, clangd). They need to be manually started, but images are stored in the container registry already

Once we have clangd in integrated, we have together with pyright and eclispe.jdt.ls enough complex language server (worker and web socket conn.) available to integrate different ways of file synchronizations. This PR enables more future enhancements.

@kaisalmen kaisalmen changed the title WIP: Port Clangd example, language server images, language wrapper improvements WIP: Add Clangd-wasm example, build LS images with GHA, LanguageClientWrapper improvements Aug 23, 2024
@CGNonofr
Copy link
Collaborator

I did some investigation around clangd and the possibility to run it in the browser already, here's what I've found:

I was able to run a small C program compiled into wasm, properly accessing the VSCode virtual filesystem. But since it doesn't support some basic features like threads, it failed to run any "advanced" binaries

The only option currently seems to be https://github.com/guyutongxue/clangd-in-browser, but I wonder if it's able to interact with the filesystem, and how?

@kaisalmen
Copy link
Collaborator Author

kaisalmen commented Aug 23, 2024

I did some investigation around clangd and the possibility to run it in the browser already

@CGNonofr Great, thanks for sharing 👍 If this becomes fully working in the browser at one point in time (via whatever tech) it will be awesome.

The only option currently seems to be https://github.com/guyutongxue/clangd-in-browser, but I wonder if it's able to interact with the filesystem, and how?

It brings its own virtual file system. You can read and write files (done here: https://github.com/TypeFox/monaco-languageclient/blob/clangd-example/packages/examples/src/clangd/worker/clangd-server.ts)

@CGNonofr
Copy link
Collaborator

It brings its own virtual file system. You can read and write files (done here: https://github.com/TypeFox/monaco-languageclient/blob/clangd-example/packages/examples/src/clangd/worker/clangd-server.ts)

Isn't there any way to provide our own implementation instead? which would access the VSCode filesystem? That would be a shame to have to watch the filesystem to register the files one by one

@kaisalmen
Copy link
Collaborator Author

Isn't there any way to provide our own implementation instead?

The wasm already contains the header files meaning when you have it loaded you can read all the header files as far as I understand it. Something must be adjusted in the build process to change that, I guess. I did not investigate any of this so far.

@kaisalmen
Copy link
Collaborator Author

But now we can start to play with it and try things...

@kaisalmen
Copy link
Collaborator Author

@CGNonofr I will open up a second PR with the wrapper improvements and base this one on it. I need to fix some build problems first.

@kaisalmen kaisalmen changed the title WIP: Add Clangd-wasm example, build LS images with GHA, LanguageClientWrapper improvements WIP: Add Clangd-wasm example, build LS images with GHA Sep 5, 2024
@kaisalmen kaisalmen force-pushed the clangd-example branch 4 times, most recently from 0391847 to 5a9438b Compare September 5, 2024 19:45
@kaisalmen kaisalmen force-pushed the clangd-example branch 5 times, most recently from ff7bd8e to a43b165 Compare October 2, 2024 14:53
@kaisalmen kaisalmen force-pushed the clangd-example branch 2 times, most recently from f599c58 to 2843ca9 Compare October 7, 2024 19:46
@kaisalmen kaisalmen force-pushed the clangd-example branch 6 times, most recently from f5ae2d7 to fa127b8 Compare October 11, 2024 13:40
@kaisalmen
Copy link
Collaborator Author

@CGNonofr maybe we should this merge at some, even if there are improvements required and improve it subsequently (file handling needs polishing and even some parts should be extracted out the examples. I have to make up my mind)

The example should contain a sentence that this is still a prototype and the underlying code is still evolving.

- Condense code
- Make use of new wrapper features
- Increase clangd timeout to 150 minutes
@kaisalmen kaisalmen force-pushed the clangd-example branch 2 times, most recently from 64f9110 to b1f96a6 Compare October 23, 2024 12:03
@kaisalmen kaisalmen changed the title WIP: Add Clangd-wasm example, build LS images with GHA Add Clangd-wasm example, build LS images with GHA Oct 23, 2024
@kaisalmen kaisalmen marked this pull request as ready for review October 23, 2024 12:06
- define file system endpoints
- clangd LS uses message port for communication
- Use wtm new ComChannelEndpoints for handling async communication of message channels or workers
- worker transfers files to client via message channel
- clangd example: list open files below editor
- Prototype: File system related code added to monaco-languageclient/fs
@kaisalmen
Copy link
Collaborator Author

@CGNonofr this is ready for merge on my side. There will be improvements.

@kaisalmen kaisalmen merged commit 296bb89 into main Oct 23, 2024
4 checks passed
@kaisalmen kaisalmen deleted the clangd-example branch October 23, 2024 12:28
@kaisalmen
Copy link
Collaborator Author

@CGNonofr thank you. This is the most complex example to date with many different facets. It could also evolve to a more vscode like editor with explorer view by utilizing the views service. The opened file drop-down is just a simple hack for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants